package com.polaris.live.resp.back_resp

import com.polaris.live.im.sfs.bean.live.ext.UserBasicVo
import com.polaris.live.im.sfs.bean.pusher.UserStateMessage
import com.polaris.live.utils.state.copyState

/**
 * DisplayUserVo，展示用户
 */
data class DisplayUserBean(
    /**
     * 实际价格
     */
    val actualPrice: Long,
    /**
     * 用户基本信息
     */
    val base: UserBasicVo,
    /**
     * 背景图
     */
    val cover: String? = null,
    /**
     * 房间欢迎语
     */
    val roomWelcomeSpeech: String? = null,
    /**
     * 状态背景
     */
    val stateBackground: String? = null,
    /**
     * 拉流地址
     */
    val playStreamId: String? = null,
    /**
     * 停留人数
     * 只有直播的时候会有此人数 其他都是0
     */
    val stayUser: Long,
    /**
     * 是否关注
     */
    var follow: Boolean,
    /**
     * 是否同语言
     */
    val sameLanguage: Boolean? = null,
    /**
     * 麦位上的用户
     */
    val siteUsers: List<String>? = null,
    /**
     * 游戏名字
     */
    var gameName: String? = null,
    /**
     * 游戏Icon
     */
    var gameIcon: String? = null,
    /**
     * 游戏等级
     */
    val gameLevel: Int? = null,
    /**
     * 房间角标
     */
    val symbol: DisplayUserSymbolResp? = null,
    /**
     * 勋章展示
     */
    val medal: List<String>? = null,
    /**
     * 房间id
     */
    val roomId: String? = null,
    /**
     * 房间名称
     */
    val roomName: String? = null,
    /**
     * 房间类型
     *  NORMAL(0, "普通", 1),
     *     AGENCY(1, "公会", 2),
     *     OFFICIAL(2, "官方", 9)
     */
    val roomType: Int? = null,

    val roomSymbol: RoomSymbol? = null,
)

/**
 * RoomSymbol
 */
data class RoomSymbol(
    /**
     * 图标
     */
    val icon: String,

    /**
     * 名称
     */
    val name: String,
)

/**
 * 展示用户标志
 */
data class DisplayUserSymbolResp(
    /**
     * 文本
     */
    val content: String,

    /**
     * 图标
     */
    val icon: String,

    /**
     * 1:Rec
     */
    val type: Int,
)

fun DisplayUserBean.copyState(message: UserStateMessage): DisplayUserBean {
    return copy(
        base = base.copyState(message),
        gameName = message.state.gameName,
        gameIcon = message.state.gameIcon,
        roomId = message.state.roomId
    )
}